package com.ziytek.web.citizen.service;

import com.google.gson.Gson;
import com.ziytek.web.citizen.config.caffeine.CaffeineUtil;
import com.ziytek.web.citizen.model.vo.OperationVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author fenghx
 */
@Slf4j
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OperationVoCacheService {
    private final Gson gson;

    public void putOperationVo(String key, OperationVo operationVo) {
        CaffeineUtil.set(key, operationVo, 24 * 60 * 60 * 60);
        //log.info("指令操作记录信息缓存putOperationVo,key:{},vo:{}", key, gson.toJson(operationVo));
    }

    public OperationVo getOperationVo(String key) {
        //log.info("getOperationVo: key-{}", key);
        return CaffeineUtil.get(key);
    }
}
